﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="student-list.aspx.cs" Inherits="student_student_list" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <title>Student Listing</title>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="bodyContentTop" runat="Server">
    <h1>
        Student</h1>
    <h3>
        How many students have in selected school?.</h3>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="bodyContent" runat="Server">
    <div class="elements_inner_wrapper">
        <div id="contentBody">
            <div class="section">
                <div class="seperator">
                </div>
                <fieldset class="formouter">
                    <div runat="server" id="divSearch">
                        <table cellpadding="3" cellspacing="3" width="100%">
                            <tr>
                                <td valign="top">
                                    <div class="row_curved" id="divSchoolList" runat="server" title="Example:UCSM, MIT, YTU">
                                        <label for="<%=ddlSchoolList.ClientID%>" class="mand_red">
                                            <asp:Label runat="server" Text="Selected School Name" ID="Label2" /></label>
                                        <div class="field">
                                            <span class="indicator">
                                                <asp:DropDownList AutoPostBack="True" runat="server" ID="ddlSchoolList" OnSelectedIndexChanged="ddlSchoolList_SelectedIndexChanged" />
                                                <asp:RequiredFieldValidator ID="rfvSchoolList" ValidationGroup="StudentProfile" ControlToValidate="ddlSchoolList"
                                                    runat="server" CssClass="validationErrorControl" Display="Dynamic" ErrorMessage="<br/>Please select a school name.<br/>"></asp:RequiredFieldValidator>
                                            </span>
                                        </div>
                                        <div class="clear">
                                        </div>
                                    </div>
                                    <div class="row_curved" id="divFirst" runat="server">
                                        <label for="<%=txtName.ClientID%>" class="mand_red">
                                            <asp:Label runat="server" Text="Name" ID="lblFirstName" Width="140px" /></label>
                                        <span class="indicator">
                                            <asp:TextBox Width="270px" ID="txtName" MaxLength="50" runat="server" />
                                        </span>
                                        <div class="clear">
                                        </div>
                                    </div>
                                    <div class="row_curved" id="divNRIC" runat="server">
                                        <label for="<%=txtNRIC.ClientID%>" class="mand_red">
                                            <asp:Label runat="server" Text="NRIC No" ID="Label3" Width="140px" /></label>
                                        <span class="indicator">
                                            <asp:TextBox Width="270px" ID="txtNRIC" MaxLength="50" runat="server" />
                                        </span>
                                        <div class="clear">
                                        </div>
                                    </div>
                                    <div class="row_curved" id="divAddress" runat="server">
                                        <label for="<%=txtAddress.ClientID%>" class="mand_red">
                                            <asp:Label runat="server" Text="Address" ID="Label1" Width="140px" /></label>
                                        <span class="indicator">
                                            <asp:TextBox Width="270px" ID="txtAddress" MaxLength="50" runat="server" />
                                        </span>
                                        <div class="clear">
                                        </div>
                                    </div>
                                </td>
                                <td valign="top">
                                    <asp:UpdatePanel runat="server" ID="uplCountry">
                                        <ContentTemplate>
                                            <div class="row_curved" id="divCountry" runat="server">
                                                <label for="<%=ddlCountry.ClientID%>" class="mand_red">
                                                    <asp:Label runat="server" Text="Country" ID="lblCountry" Width="120px" /></label>
                                                <span class="indicator">
                                                    <asp:DropDownList Width="100px" AutoPostBack="true" runat="server" ID="ddlCountry"
                                                        OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged">
                                                    </asp:DropDownList>
                                                </span>
                                                <div class="clear">
                                                </div>
                                            </div>
                                            <div class="row_curved" id="divDisctrict" runat="server">
                                                <label for="<%=ddlDistrict.ClientID%>" class="mand_red">
                                                    <asp:Label runat="server" Text="Province" ID="lblDistrict" /></label>
                                                <span class="indicator">
                                                    <asp:DropDownList Width="100px" AutoPostBack="true" runat="server" ID="ddlDistrict"
                                                        OnSelectedIndexChanged="ddlDistrict_SelectedIndexChanged">
                                                        <asp:ListItem Text="Select" Value="-1" />
                                                    </asp:DropDownList>
                                                </span>
                                                <label for="<%=ddlCity.ClientID%>" style="width: 80px;" class="mand_red">
                                                    <asp:Label runat="server" Text="City Name" ID="lblCity" /></label>
                                                <asp:DropDownList Width="100px" runat="server" ID="ddlCity">
                                                    <asp:ListItem Text="Select" Value="-1" />
                                                </asp:DropDownList>
                                                <div class="clear">
                                                </div>
                                            </div>
                                        </ContentTemplate>
                                    </asp:UpdatePanel>
                                    <div class="row_curved" id="divAddressType" runat="server">
                                        <label for="<%=ddlAddressType.ClientID%>" class="mand_red">
                                            <asp:Label runat="server" Text="Address Type" ID="Label4" Width="140px" /></label>
                                        <span class="indicator">
                                            <asp:DropDownList ID="ddlAddressType" runat="server" CssClass="inputbox_medium">
                                                <asp:ListItem Text="Resident Address" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Contact Address" Value="2" />
                                                <asp:ListItem Text="Mailing Address" Value="3" />
                                            </asp:DropDownList>
                                        </span>
                                        <div class="clear">
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <div class="row_curved" style="background-color: #efefef;" id="divButton" runat="server">
                                        <div class="field" style="width: 750px;">
                                            <span class="indicator">
                                                <asp:Button runat="server" ID="btnAddNewStudent" Text="Add New Student" OnClick="btnAddNewStudent_Click" />
                                                &nbsp;&nbsp;
                                                <asp:Button Visible="true" runat="server" ID="btnSearchStudent" Text="Search" OnClick="btnSearchStudent_Click" />
                                            </span>
                                        </div>
                                        <div class="clear">
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <br />
                    <div id="divSearchResult" runat="server">
                        <table cellpadding="3" cellspacing="3" width="100%">
                            <tr>
                                <td colspan="2">
                                    <asp:Button Visible="true" runat="server" ID="btnBackToSearch" Text="Back to Search Option"
                                        OnClick="btnBackToSearch_Click" />
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <h3>
                                        Search Results</h3>
                                    <asp:GridView ID="grvStudentProfile" runat="server" AutoGenerateColumns="False" DataKeyNames="StudentProfileKey,UserAccountKey"
                                        CellPadding="4" Width="850px" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="grvStudentProfile_SelectedIndexChanged">
                                        <RowStyle BackColor="#EFF3FB" />
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <Columns>
                                            <asp:BoundField DataField="StudentProfileKey" HeaderText="StudentProfileKey" InsertVisible="False"
                                                ReadOnly="True" SortExpression="StudentProfileKey" Visible="False" />
                                            <asp:BoundField DataField="StudentProfileKey" HeaderText="ID" SortExpression="StudentProfileKey" />
                                            <asp:BoundField DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" />
                                            <asp:BoundField DataField="LastName" HeaderText="SurName" SortExpression="LastName" />
                                            <asp:BoundField DataField="OtherName" HeaderText="OtherName" SortExpression="OtherName" />
                                            <asp:BoundField DataField="Gender" HeaderText="Gender" SortExpression="Gender" />
                                            <asp:BoundField DataField="CreatedDateTime" HeaderText="CreatedDateTime" SortExpression="CreatedDateTime"
                                                Visible="False" />
                                            <asp:BoundField DataField="ModifiedDateTime" HeaderText="ModifiedDateTime" ReadOnly="True"
                                                SortExpression="ModifiedDateTime" />
                                            <asp:HyperLinkField Text="Edit Details" DataNavigateUrlFormatString="~/student/?id={0}"
                                                DataNavigateUrlFields="UserAccountKey" />
                                            <asp:HyperLinkField Text="Register" DataNavigateUrlFormatString="~/student/student-registration.aspx?id={0}"
                                                DataNavigateUrlFields="UserAccountKey" />
                                            <asp:CommandField ShowSelectButton="True" ButtonType="Button" />
                                        </Columns>
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <EmptyDataTemplate>
                                            Please add new student of selected school.
                                        </EmptyDataTemplate>
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:GridView>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <div runat="server" id="divSelectedKeys" visible="false">
                                        <asp:Label runat="server" ID="lblSelectedStudentProfileKey" />
                                        <asp:Label runat="server" ID="lblSelectedStudentUserAccountKey" />
                                    </div>
                                    <h3>
                                        Selected student's registration list</h3>
                                    <asp:GridView ID="grvRegister" runat="server" AutoGenerateColumns="False" DataKeyNames="SRID"
                                        CellPadding="4" Width="850px" ForeColor="#333333" GridLines="None" OnSelectedIndexChanged="grvStudentProfile_SelectedIndexChanged"
                                        DataSourceID="odsRegistrationView">
                                        <RowStyle BackColor="#EFF3FB" />
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <Columns>
                                            <asp:BoundField DataField="SRID" HeaderText="SRID" InsertVisible="False" ReadOnly="True"
                                                SortExpression="SRID" />
                                            <asp:BoundField DataField="UserAccountKey" HeaderText="UserAccountKey" SortExpression="UserAccountKey"
                                                Visible="false" />
                                            <asp:BoundField DataField="SchoolKey" HeaderText="SchoolKey" SortExpression="SchoolKey"
                                                Visible="false" />
                                            <asp:BoundField DataField="EducationPeriodDesc" HeaderText="Period" SortExpression="EducationPeriodDesc" />
                                            <asp:BoundField DataField="StudentProfileKey" HeaderText="StudentProfileKey" SortExpression="StudentProfileKey"
                                                Visible="false" />
                                            <asp:BoundField DataField="SchoolMajorCode" HeaderText="Major" SortExpression="SchoolMajorCode"
                                                Visible="true" />
                                            <asp:BoundField DataField="StandardLevelKey" HeaderText="Standard" SortExpression="StandardLevelKey"
                                                Visible="false" />
                                            <asp:BoundField DataField="StandardLevelCode" HeaderText="Standard" SortExpression="StandardLevelCode"
                                                Visible="true" />
                                            <asp:BoundField DataField="ClassRoomKey" HeaderText="ClassRoomKey" SortExpression="ClassRoomKey"
                                                Visible="false" />
                                            <asp:BoundField DataField="ClassRoomName" HeaderText="Class" SortExpression="ClassRoomName" />
                                            <asp:BoundField DataField="EducationPeriodKey" HeaderText="Education Period" SortExpression="EducationPeriodKey"
                                                Visible="false" />
                                            <asp:BoundField DataField="Remark" HeaderText="Remark" SortExpression="Remark" Visible="false" />
                                            <asp:CheckBoxField DataField="Status" HeaderText="Status" Visible="false" SortExpression="Status" />
                                            <asp:BoundField DataField="CreatedDateTime" HeaderText="CreatedDateTime" SortExpression="CreatedDateTime"
                                                Visible="false" />
                                            <asp:BoundField DataField="ModifiedDateTime" HeaderText="ModifiedDateTime" SortExpression="ModifiedDateTime" />
                                            <asp:HyperLinkField Text="Edit" DataNavigateUrlFormatString="~/student/student-registration.aspx?id={0}&srid={1}"
                                                DataNavigateUrlFields="UserAccountKey, SRID" />
                                            <asp:HyperLinkField Text="Payment" DataNavigateUrlFormatString="~/student/fee-payment.aspx?feetypecode=1001&paymentref={0}&uid={1}"
                                                DataNavigateUrlFields="SRID,UserAccountKey" />
                                        </Columns>
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <EmptyDataTemplate>
                                            No registeration found for selected student.
                                        </EmptyDataTemplate>
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="odsRegistrationView" runat="server" ConnectionString="<%$ ConnectionStrings:sis.dbconn %>"
                                        SelectCommand="sprocStudentRegisterationTableSelectListView" SelectCommandType="StoredProcedure">
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="ddlSchoolList" Name="SchoolKey" PropertyName="SelectedValue"
                                                Type="Int32" />
                                            <asp:ControlParameter ControlID="lblSelectedStudentProfileKey" Name="StudentProfileKey"
                                                PropertyName="Text" Type="Int32" />
                                            <asp:ControlParameter ControlID="lblSelectedStudentUserAccountKey" Name="UserAccountKey"
                                                PropertyName="Text" Type="Int32" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                                    <br />
                                    <h3>
                                        New Outstanding Fee</h3>
                                    <asp:GridView ID="grvSFPTOutstanding" runat="server" AutoGenerateColumns="False"
                                        CellPadding="4" Width="650px" DataKeyNames="FeeTypeCode" EmptyDataText="No new outstanding fee."
                                        DataSourceID="sqlDSStudentFeeTransNewOutStanding" ForeColor="#333333" GridLines="None">
                                        <RowStyle BackColor="#EFF3FB" />
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <Columns>
                                            <asp:BoundField DataField="FeeTypeCode" HeaderText="FeeTypeCode" ReadOnly="True"
                                                SortExpression="FeeTypeCode" Visible="false" />
                                            <asp:BoundField DataField="FeeType" HeaderText="Type" SortExpression="FeeType" />
                                            <asp:BoundField DataField="FeeGroup" HeaderText="Group" SortExpression="FeeGroup" />
                                            <asp:BoundField DataField="FeeDetail" HeaderText="Decription" SortExpression="FeeDetail" />
                                            <asp:BoundField DataField="TOTALOUTAMOUNT" DataFormatString="{0:F2}" HeaderText="Total"
                                                ReadOnly="True" SortExpression="TOTALOUTAMOUNT" />
                                            <asp:HyperLinkField Text="Payment" DataNavigateUrlFormatString="~/student/fee-payment.aspx?feetypecode=1001&paymentref={0}&sfkey={1}&sfdkey={2}"
                                                DataNavigateUrlFields="SRID,StudentFeeKey, SFDKey" />
                                        </Columns>
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="sqlDSStudentFeeTransNewOutStanding" runat="server" ConnectionString="<%$ ConnectionStrings:sis.dbconn %>"
                                        SelectCommand="sprocStudentFeePaymentNewOutStandingSelectList" SelectCommandType="StoredProcedure">
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="lblSelectedStudentProfileKey" Name="StudentProfileKey"
                                                PropertyName="Text" Type="Int32" />
                                            <asp:Parameter DefaultValue="1001" Name="FeeTypeCode" Type="Int16" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                                    <br />
                                    <h3>
                                        Pending Outstanding Fee</h3>
                                    <asp:GridView ID="grvSFPTPending" runat="server" AutoGenerateColumns="False" CellPadding="4"
                                        DataKeyNames="FeeTypeCode" Width="650px" EmptyDataText="No outstanding pedning fee."
                                        DataSourceID="sqlDSStudentFeeTransPending" ForeColor="#333333" GridLines="None">
                                        <RowStyle BackColor="#EFF3FB" />
                                        <HeaderStyle HorizontalAlign="Left" />
                                        <Columns>
                                            <asp:BoundField DataField="FeeTypeCode" HeaderText="FeeTypeCode" ReadOnly="True"
                                                SortExpression="FeeTypeCode" Visible="false" />
                                            <asp:BoundField DataField="FeeType" HeaderText="Type" SortExpression="FeeType" />
                                            <asp:BoundField DataField="FeeGroup" HeaderText="Group" SortExpression="FeeGroup" />
                                            <asp:BoundField DataField="FeeDetail" HeaderText="Description" SortExpression="FeeDetail" />
                                            <asp:BoundField DataField="TOTALAMOUNT" DataFormatString="{0:F2}" HeaderText="Total"
                                                ReadOnly="True" SortExpression="TOTALAMOUNT" />
                                            <asp:BoundField DataField="TOTALTRANSAMOUNT" DataFormatString="{0:F2}" HeaderText="Payment"
                                                ReadOnly="True" SortExpression="TOTALTRANSAMOUNT" />
                                            <asp:BoundField DataField="TOTALPENDINGAMOUNT" DataFormatString="{0:F2}" HeaderText="Pending"
                                                ReadOnly="True" SortExpression="TOTALPENDINGAMOUNT" />
                                            <asp:HyperLinkField Text="Payment" DataNavigateUrlFormatString="~/student/fee-payment.aspx?feetypecode=1001&paymentref={0}&sfkey={1}&sfdkey={2}"
                                                DataNavigateUrlFields="SRID,StudentFeeKey, SFDKey" />
                                        </Columns>
                                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                                        <EditRowStyle BackColor="#2461BF" />
                                        <AlternatingRowStyle BackColor="White" />
                                    </asp:GridView>
                                    <asp:SqlDataSource ID="sqlDSStudentFeeTransPending" runat="server" ConnectionString="<%$ ConnectionStrings:sis.dbconn %>"
                                        SelectCommand="sprocStudentFeePaymentPendingSelectList" SelectCommandType="StoredProcedure">
                                        <SelectParameters>
                                            <asp:ControlParameter ControlID="lblSelectedStudentProfileKey" Name="StudentProfileKey"
                                                PropertyName="Text" Type="Int32" />
                                            <asp:Parameter DefaultValue="1001" Name="FeeTypeCode" Type="Int16" />
                                        </SelectParameters>
                                    </asp:SqlDataSource>
                                </td>
                            </tr>
                        </table>
                    </div>
                </fieldset>
            </div>
        </div>
    </div>
</asp:Content>
